package main

import "fmt"

//定义接口
type Skill interface {
	Run() (seconds int)
	GetName() (name string)
}

//定义结构体
type Teacher struct {
	Name string
	Age  int
}

//定义结构体
type Manager struct {
	Name   string
	Height float64
}

//该结构体需要实现接口里面的所有的方法。
//为Teacher实现接口的GetName方法
func (s Teacher) GetName() string {
	fmt.Println(s.Name)
	return s.Name
}

//为Teacher实现接口的Run方法
func (t Teacher) Run() int {
	fmt.Println("3分钟30秒")
	return 210
}

//为Manager实现接口的GetName方法
func (s Manager) GetName() string {
	fmt.Println(s.Name)
	return s.Name
}

//为Manager实现接口的Run方法
func (t Manager) Run() int {
	fmt.Println("3分钟30秒")
	return 210
}
func TestInterface() {
	var skill Skill
	var t Teacher
	var m Manager

	t.Name = "Liming"
	t.Age = 12
	m.Name = "Jerry"
	m.Height = 1.8

	skill = t
	name := skill.GetName()
	fmt.Println(name)
	s := skill.Run()
	fmt.Println(s)

	skill = m
	name = skill.GetName()
	fmt.Println(name)
	s = skill.Run()
	fmt.Println(s)
}
